package com.stock.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum StockTypeEnum {

    BUY(1,"买入"),SELL(2,"卖出");

    private int code;

    private String desc;

    public static String getDesc(Integer code) {
        for (StockTypeEnum type : StockTypeEnum.values()) {
            if (ObjectUtil.equal(type.getCode(),code)) {
                return type.getDesc();
            }
        }
        return null;
    }

}
